package sk.atletis.atletika;

import android.os.Bundle;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.support.v4.app.NavUtils;
import android.view.MenuItem;
import android.webkit.WebView;

public class WebViewActivity extends Activity 
{
	public static final String DOC_PATH = "docPath";
	
	@SuppressLint("SetJavaScriptEnabled")
	@Override
	protected void onCreate(Bundle savedInstanceState) 
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.fragment_web_view);
		
		getActionBar().setDisplayHomeAsUpEnabled(true);
		
		Intent parent = this.getIntent();
		String sPath = parent.getStringExtra(DOC_PATH);
		
		WebView webView = (WebView) this.findViewById(R.id.wvDocument);
		webView.getSettings().setJavaScriptEnabled(true); 
		webView.loadUrl("https://docs.google.com/gview?embedded=true&url=" + sPath);
	}
	
	@Override
    public boolean onOptionsItemSelected(MenuItem item) 
	{
        switch (item.getItemId()) 
        {
        	case android.R.id.home:
        		NavUtils.navigateUpFromSameTask(this);
				return true;
        }

        return super.onOptionsItemSelected(item);
    }
	
	
	

}
